local js_yechou = fk.CreateSkill {
  name = "js__yechou",
}

js_yechou:addEffect(fk.Death , {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self, false, true)
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local targets = table.map(room:getOtherPlayers(player, false), Util.IdMapper)
    local to = room:askForChoosePlayers(player, targets, 1, 1, "#js__yechou-choose", self.name, true)
    if #to > 0 then
      event:setCostData(self,to)
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = room:getPlayerById(event:getCostData(self)[1])
    room:addPlayerMark(to, "@@js__yechou", 1)
  end,
})
js_yechou:addEffect(fk.DamageInflicted , {
  mute = true,
  can_trigger = function(self, event, target, player, data)
    return target == player and player:getMark("@@js__yechou") > 0 and data.damage >= player.hp
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player:broadcastSkillInvoke("js__yechou")
    room:notifySkillInvoked(player, "js__yechou", "negative")
    data.damage = data.damage * (2 ^ player:getMark("@@js__yechou"))
  end,
})
return js_yechou